<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Blogger_Delete extends Controller{

public function action_id()
{
	$id = $this->request->param('id');
	$blog = ORM::factory('blog')
		->where('id', '=', $id)
		->and_where('user_id', '=', Auth::instance()->get_user()->id)
		->find();
	if ($blog->loaded())
	{
		$blog->delete();
	}

	$this->request->redirect('blogger/dashboard');
}

/**
* Initialize properties before running the controller methods (actions),
* so they are available to our action.
*/
public function before()
{
	// Run anything that need ot run before this.
	parent::before();

	if (!Auth::instance()->logged_in())
	{
		$this->request->redirect('/user/login');
	}
}

}




